<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
        <script src="http://code.jquery.com/jquery-1.12.4.js" 
        integrity="sha256-Qw82+bXyGq6MydymqBxNPYTaUXXq7c8v3CwiYwLLNXU="
        crossorigin="anonymous"></script>
        <script>
            $(function (param) {
                //1.给按钮添加点击事件
                var btn=document.getElementsByTagName("button")[0];
                btn.onclick=function(){
                    //2.获取输入框输入的内容
                    var input=document.getElementsByTagName("input")[0];
                    var text=input.value;
                    //3.修改img的src属性的值
                    $("img").attr("src",text);
                    $("img").prop("src",text);
                }
                
              });
        </script>
    </head>
    <body>
        <input type="text">
        <button>切换图片</button>
        <img src="https://www.baidu.com/img/bd_logo1.png" alt="">
    </body>
</html>